﻿using TestClientsCommon;
using smp.RabbitMq;

namespace Subscriber1a
{
    class Program
    {
        static void Main(string[] args)
        {
            var factory = new RabbitMqFactory();

            var handlers = new SubscriberHandlers()
                .Add(new Message1Subscriber1())
                .Add(new Message1Subscriber1Slow());

            

            using (var subscriber = factory.CreateSubscriber(handlers, new Config()))
            {
                subscriber.HostSubscriberServer();
            }
        }

        public class Config : IRabbitMqConfiguration
        {
            public Config()
            {
                Host = "localhost";
                VirtualHost = "smp";
                Username = "guest";
                Password = "guest";
                Exchange = "smp_ex_1";
                Queue = "smp_Subscriber1Queue";
                RoutingKey = "route1";
                ExchangeType = RabbitMqExchangeType.direct;
                DurableExchange = true;
                DurableQueue = true;
            }
            #region Implementation of IRabbitMqConfiguration

            public string Host { get; private set; }
            public string VirtualHost { get; private set; }
            public string Username { get; private set; }
            public string Password { get; private set; }
            public int? Port { get; private set; }
            public string Exchange { get; private set; }
            public string RoutingKey { get; private set; }
            public RabbitMqExchangeType ExchangeType { get; private set; }
            public bool DurableExchange { get; private set; }
            public bool AutoDeleteExchange { get; private set; }
            public string Queue { get; private set; }
            public bool DurableQueue { get; private set; }
            public bool AutoDeleteQueue { get; private set; }
            public bool ErrorQueue { get; private set; }
            public bool SupportsLongSleepQueue { get; private set; }

            #endregion
        }
    }
}
